
<!DOCTYPE html>
<html>

<div th:replace="common/jsCssRef :: jsfJsCssRef"></div>

<body class="bgf6">

    <div th:replace="common/head :: jsfHeader"></div>

<div class="main-body pb100">
    <div class="container pt10">
        <div class="dflx sbt">

            <div th:replace="common/left :: jsfLeft"></div>

            <div class="body-right">
                <div class="bread-nav bgff">
                    <ul class="dflx">
                        <li><a href="">首页</a></li>
                        <li><a href="">统筹规划</a></li>
                        <li><a href="">中长期项目库</a></li>
                    </ul>
                </div>

                <div class="bgff mt10" id="app">
                    <div class="wrap">
                        <!--筛选条件/操作-->
                        <div class="row">
                            <div class="col-md-4">
                                <input type="text" id="projectName" class="form-control" placeholder="请输入项目名称">
                            </div>

                            <div class="col-md-4">
                                <select id="belongUnitId" class="form-control c999">
                                    <option value='' disabled selected class='none'>所属单位</option>
                                    <option value="1">1</option>
                                    <option value="2">2</option>
                                </select>
                            </div>

                            <div class="col-md-4">
                                <select id="projectCategoryCode" class="form-control c999">
                                    <option value='' disabled selected class='none'>项目类型</option>
                                    <option value="1">全市发展规划</option>
                                    <option value="2">专向发展规划</option>
                                </select>
                            </div>


                        </div>

                        <div class="row mt15">
                            <div class="col-md-4">
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="开始时间" id="planBeginTime">
                                </div>
                            </div>

                            <div class="col-md-4">
                                <div class="input-group">
                                    <input type="text" class="form-control" placeholder="结束时间" id="planEndTime">
                                </div>
                            </div>

                            <div class="col-md-4 tr">
                                <button type="button" class="btn btn-primary f12" @click="loadPlanList()"> 查询 </button>
                                <button type="button" class="btn btn-white f12"> 重置 </button>
                            </div>
                        </div>

                        <div class="mt30 dflx sbt">
                            <button type="button" class="btn btn-primary f12" onclick="toAdd();"> 新增中长期项目 </button>
                            <div class="">
                                <button type="button" class="btn btn-white f12"> 批量导入 </button>
<!--                                <button type="button" class="btn btn-white f12"> 批量删除 </button>-->
                            </div>
                        </div>

                        <!--表格部分-->
                        <table class="table th52 f14 table-bordered mt20 table-hover">
                            <template>
                                <el-table
                                        ref="multipleTable"
                                        :data="plans"
                                        tooltip-effect="dark"
                                        style="width: 100%"
                                        @selection-change="handleSelectionChange">

                                    <el-table-column
                                            label="序号"
                                            width="60">
                                        <template slot-scope="scope">{{ scope.row.projectId }}</template>
                                    </el-table-column>
                                    <el-table-column
                                            prop="projectName"
                                            label="项目名称"
                                            width="150">
                                    </el-table-column>
                                    <el-table-column
                                            prop="projectNo"
                                            label="项目编号"
                                            width="150">
                                    </el-table-column>
                                    <el-table-column
                                            prop="projectCategoryName"
                                            label="项目类型"
                                            width="120">
                                    </el-table-column>
                                    <el-table-column
                                            prop="belongUnitName"
                                            label="所属单位"
                                            width="120">
                                    </el-table-column>
                                    <el-table-column
                                            prop="planBeginTime"
                                            label="计划开始时间"
                                            width="120">
                                    </el-table-column>
                                    <el-table-column label="操作">
                                        <template slot-scope="scope">
                                            <el-link type="primary" :href="'/view/toMediumlangDetail?id=' + scope.row.projectId">查看</el-link>
                                            <el-link type="primary" :href="'/view/toMediumlangEdit?id=' + scope.row.projectId">编辑</el-link>
                                        </template>
                                    </el-table-column>
                                </el-table>
                            </template>

                        </table>

                        <!--表格尾部-->
                        <div class="dflx aic sbt pb20">
                            <el-pagination
                                    @size-change="handleSizeChange"
                                    @current-change="handleCurrentChange"
                                    :current-page="currentPage"
                                    :page-sizes="[2, 3, 4]"
                                    :page-size="2"
                                    layout="total, sizes, prev, pager, next, jumper"
                                    :total="totalPage">
                            </el-pagination>
                        </div>




                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

    $('#midLong').addClass('active');



    $(".table input[type=checkbox]").change(function() {
        var stat = $(this).prop('checked');
        if(stat){
            $(this).parents("tr").addClass("selected");
        }else{
            $(this).parents("tr").removeClass("selected");
        }
    });

    function toAdd() {
        window.location.href = contentPath + '/view/toAddMediumlang';
    }

    var appPage = new Vue({
        el : '#app',
        data : {
            plans:[],
            multipleSelection: [],
            currentPage : 1,
            totalPage : 1,
            pageSize : 2
        },
        created : function() {
            this.loadPlanList();
        },
        computed : {

        },
        methods : {
            loadPlanList : function () {
                let that = this;
                $.ajax({
                    'url' : contentPath + '/mediumLongTermpm/getList',
                    'dataType' : 'json',
                    'type' : 'get',
                    'data' : {
                        pageSize: that.pageSize,   //页面大小originUnit
                        pageNumber: that.currentPage,//页码
                        projectName: $("#projectName").val(),
                        belongUnitId: $('#belongUnitId').val(),
                        projectCategoryCode: $("#projectCategoryCode").val(),
                        planBeginTime: $('#planBeginTime').val(),
                        planEndTime:$('#planEndTime').val()
                    },
                    'success' : function (result) {
                        if (result.code != 1000) {
                            alert(result.message);
                            return;
                        }

                        appPage.plans = result.data.records;
                        appPage.totalPage = result.data.total;
                    },
                    'error' : function (result) {
                    }
                });
            },
            handleSelectionChange :  function (val) {
                this.multipleSelection = val;
            },

            planStatus : function (val) {
                return statusPlanObj[val];
            },

            handleSizeChange : function(val) {
                this.pageSize = val;
                this.loadPlanList();
            },

            handleCurrentChange : function(val) {
                this.currentPage = val;
                this.loadPlanList();
            },

            delPlan : function (val) {
                this.$confirm('此操作将永久删除该项目, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    delPlanSign(val);

            }).catch(() => {
                    this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
            }


        }
    })


    $('#planBeginTime').fdatepicker({
        format: 'yyyy-mm-dd',
    });
    $('#planEndTime').fdatepicker({
        format: 'yyyy-mm-dd',
    });

</script>
</body>
</html>
